﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using A2DFramework.SessionService.Configuration;

namespace A2DFramework.SessionService
{
    public class MongoDBSessionPartitionResolver : IPartitionResolver
    {
        public void Initialize()
        {
        }

        public string ResolvePartition(object key)
        {
            string sessionId = (string)key;
            string prefix;
            string realId;

            if (!Helper.ParseSessionID(sessionId, out prefix, out realId))
                return string.Empty;

            return SessionConfiguration.SessionIdentityMongoDBMap[prefix];
        }
    }
}
